import Vue from "vue";
import App from "./App";
import router from "./router";
import store from "./store";
import './lib/rem'
import VueScroller from './plugIn/vue-scroller/src/index'
import 'mint-ui/lib/style.css'
// import MintUI from 'mint-ui'
Vue.use(VueScroller)
// Vue.use(MintUI)
/*console.log(__DEV__)
console.log(__SERVER_HOST__)*/

/*import elementUi from  "element-ui"
Vue.use(elementUi)
import './theme/ui/index.css'*/

const Auth=["Login","Home","Registr","LoadDetail","Advertisement"]

router.beforeEach((to, from, next) => {
    const {name} =to,
        {userInfo ,visitPath}=store.getters;
    console.log(to.path)
    console.log(name)
    console.log(visitPath)
        if(Auth.indexOf(name) !== -1){
                next()
        }else {
            store.dispatch("setVisitPath",to.path)
            store.dispatch("getLoinInfo").then(res=>{
                next()
            }).catch(res=>{
                router.push("/login")
            })
        }


})

new Vue({
    base:__SERVER_HOST__,
    router,
    store,
    template: "<App class='root' />",
    components: {App}
}).$mount('#app');
